<template>
  <WebPie :config="getOptions" :data="data"></WebPie>
</template>

<script>
export default {
  data() {
    return {
      data: [],
    };
  },
  async created() {
    let res = await this.$api.getPie(1);
    if (res.data) {
      this.data = [
        [0, 0],
        [0.03487823687206265, 1],
        [0.06958655048003272, 2],
        [0.10395584540887964, 3],
        [0.13781867790849958, 4],
        [0.17101007166283433, 5],
        [0.2033683215379001, 6],
        [0.2347357813929454, 7],
        [0.26495963211660245, 8],
        [0.2938926261462365, 9],
        [0.3213938048432697, 10],
        [0.3473291852294986, 11],
        [0.37157241273869707, 12],
        [0.394005376803361, 13],
        [0.41451878627752087, 14],
        [0.4330127018922193, 15],
        [0.44939702314958346, 16],
        [0.4635919272833937, 17],
        [0.4755282581475768, 18],
        [0.48514786313799824, 19],
        [0.49240387650610395, 20],
        [0.4972609476841367, 21],
        [0.4996954135095479, 22],
        [0.4996954135095479, 23],
        [0.4972609476841367, 24],
        [0.49240387650610407, 25],
        [0.4851478631379983, 26],
        [0.4755282581475768, 27],
        [0.4635919272833937, 28],
        [0.44939702314958346, 29],
        [0.4330127018922194, 30],
        [0.41451878627752087, 31],
        [0.394005376803361, 32],
        [0.37157241273869723, 33],
        [0.34732918522949874, 34],
        [0.32139380484326974, 35],
        [0.29389262614623657, 36],
        [0.26495963211660245, 37],
        [0.23473578139294535, 38],
        [0.20336832153790002, 39],
        [0.1710100716628344, 40],
        [0.1378186779084996, 41],
        [0.10395584540887964, 42],
        [0.06958655048003265, 43],
        [0.03487823687206276, 44],
        [6.123233995736766e-17, 45],
        [-0.034878236872062415, 46],
        [-0.06958655048003275, 47],
        [-0.10395584540887953, 48],
        [-0.1378186779084993, 49],
        [-0.17101007166283433, 50],
        [-0.2033683215378999, 51],
        [-0.23473578139294524, 52],
        [-0.26495963211660234, 53],
        [-0.2938926261462365, 54],
        [-0.3213938048432697, 55],
        [-0.3473291852294987, 56],
        [-0.371572412738697, 57],
        [-0.39400537680336106, 58],
        [-0.4145187862775207, 59],
        [-0.4330127018922192, 60],
        [-0.4493970231495834, 61],
        [-0.4635919272833936, 62],
        [-0.4755282581475767, 63],
        [-0.4851478631379983, 64],
        [-0.49240387650610407, 65],
        [-0.4972609476841366, 66],
        [-0.4996954135095479, 67],
        [-0.4996954135095479, 68],
        [-0.4972609476841366, 69],
        [-0.49240387650610407, 70],
        [-0.4851478631379983, 71],
        [-0.4755282581475768, 72],
        [-0.4635919272833937, 73],
        [-0.4493970231495835, 74],
        [-0.4330127018922193, 75],
        [-0.4145187862775208, 76],
        [-0.3940053768033611, 77],
        [-0.371572412738697, 78],
        [-0.3473291852294988, 79],
        [-0.3213938048432698, 80],
        [-0.2938926261462366, 81],
        [-0.2649596321166025, 82],
        [-0.2347357813929454, 83],
        [-0.2033683215379001, 84],
        [-0.17101007166283472, 85],
        [-0.13781867790849947, 86],
        [-0.10395584540887992, 87],
        [-0.06958655048003294, 88],
        [-0.034878236872062825, 89],
        [-1.2246467991473532e-16, 90],
        [0.03487823687206258, 91],
        [0.06958655048003226, 92],
        [0.10395584540887969, 93],
        [0.13781867790849966, 94],
        [0.17101007166283447, 95],
        [0.20336832153789985, 96],
        [0.23473578139294518, 97],
        [0.26495963211660195, 98],
        [0.29389262614623685, 99],
        [0.3213938048432696, 100],
        [0.3473291852294986, 101],
        [0.37157241273869684, 102],
        [0.39400537680336073, 103],
        [0.41451878627752065, 104],
        [0.4330127018922194, 105],
        [0.4493970231495834, 106],
        [0.46359192728339366, 107],
        [0.4755282581475767, 108],
        [0.48514786313799807, 109],
        [0.49240387650610395, 110],
        [0.4972609476841367, 111],
        [0.4996954135095479, 112],
        [0.4996954135095478, 113],
        [0.4972609476841367, 114],
        [0.49240387650610407, 115],
        [0.4851478631379982, 116],
        [0.4755282581475768, 117],
        [0.4635919272833939, 118],
        [0.4493970231495835, 119],
        [0.4330127018922196, 120],
        [0.41451878627752087, 121],
        [0.3940053768033612, 122],
        [0.37157241273869707, 123],
        [0.34732918522949885, 124],
        [0.32139380484327024, 125],
        [0.2938926261462367, 126],
        [0.26495963211660223, 127],
        [0.23473578139294546, 128],
        [0.20336832153790052, 129],
        [0.17101007166283433, 130],
        [0.13781867790849997, 131],
        [0.10395584540888042, 132],
        [0.069586550480033, 133],
        [0.03487823687206244, 134],
        [1.8369701987210297e-16, 135],
        [-0.034878236872062075, 136],
        [-0.06958655048003265, 137],
        [-0.10395584540888006, 138],
        [-0.1378186779084996, 139],
        [-0.171010071662834, 140],
        [-0.20336832153790022, 141],
        [-0.23473578139294515, 142],
        [-0.26495963211660184, 143],
        [-0.2938926261462364, 144],
        [-0.3213938048432699, 145],
        [-0.34732918522949857, 146],
        [-0.3715724127386968, 147],
        [-0.394005376803361, 148],
        [-0.4145187862775206, 149],
        [-0.4330127018922194, 150],
        [-0.44939702314958335, 151],
        [-0.4635919272833938, 152],
        [-0.4755282581475767, 153],
        [-0.4851478631379981, 154],
        [-0.492403876506104, 155],
        [-0.4972609476841367, 156],
        [-0.4996954135095479, 157],
        [-0.4996954135095479, 158],
        [-0.49726094768413676, 159],
        [-0.49240387650610407, 160],
        [-0.48514786313799824, 161],
        [-0.47552825814757693, 162],
        [-0.4635919272833939, 163],
        [-0.44939702314958346, 164],
        [-0.4330127018922196, 165],
        [-0.41451878627752087, 166],
        [-0.39400537680336123, 167],
        [-0.37157241273869707, 168],
        [-0.3473291852294989, 169],
        [-0.32139380484327024, 170],
        [-0.2938926261462368, 171],
        [-0.26495963211660223, 172],
        [-0.23473578139294554, 173],
        [-0.2033683215379006, 174],
        [-0.17101007166283438, 175],
        [-0.13781867790850003, 176],
        [-0.10395584540888049, 177],
        [-0.06958655048003305, 178],
        [-0.034878236872062506, 179],
        [-2.4492935982947064e-16, 180],
        [0.03487823687206201, 181],
        [0.06958655048003258, 182],
        [0.10395584540887913, 183],
        [0.1378186779084987, 184],
        [0.17101007166283394, 185],
        [0.20336832153790013, 186],
        [0.23473578139294585, 187],
        [0.2649596321166026, 188],
        [0.29389262614623635, 189],
        [0.32139380484326985, 190],
        [0.3473291852294985, 191],
        [0.37157241273869673, 192],
        [0.39400537680336095, 193],
        [0.41451878627752053, 194],
        [0.4330127018922189, 195],
        [0.44939702314958296, 196],
        [0.4635919272833937, 197],
        [0.47552825814757693, 198],
        [0.48514786313799824, 199],
        [0.492403876506104, 200],
        [0.4972609476841367, 201],
        [0.4996954135095479, 202],
        [0.4996954135095478, 203],
        [0.4972609476841368, 204],
        [0.49240387650610407, 205],
        [0.4851478631379984, 206],
        [0.47552825814757715, 207],
        [0.4635919272833939, 208],
        [0.4493970231495832, 209],
        [0.4330127018922192, 210],
        [0.41451878627752087, 211],
        [0.3940053768033613, 212],
        [0.3715724127386971, 213],
        [0.3473291852294989, 214],
        [0.3213938048432703, 215],
        [0.29389262614623685, 216],
        [0.26495963211660306, 217],
        [0.23473578139294637, 218],
        [0.20336832153790063, 219],
        [0.17101007166283444, 220],
        [0.13781867790849922, 221],
        [0.10395584540887966, 222],
        [0.06958655048003312, 223],
        [0.03487823687206256, 224],
        [3.061616997868383e-16, 225],
        [-0.03487823687206195, 226],
        [-0.06958655048003252, 227],
        [-0.10395584540887907, 228],
        [-0.1378186779084986, 229],
        [-0.17101007166283388, 230],
        [-0.20336832153790088, 231],
        [-0.2347357813929458, 232],
        [-0.26495963211660256, 233],
        [-0.2938926261462363, 234],
        [-0.3213938048432691, 235],
        [-0.34732918522949785, 236],
        [-0.3715724127386973, 237],
        [-0.3940053768033609, 238],
        [-0.41451878627752053, 239],
        [-0.4330127018922189, 240],
        [-0.44939702314958285, 241],
        [-0.4635919272833937, 242],
        [-0.47552825814757677, 243],
        [-0.48514786313799807, 244],
        [-0.4924038765061041, 245],
        [-0.4972609476841367, 246],
        [-0.49969541350954794, 247],
        [-0.4996954135095479, 248],
        [-0.49726094768413676, 249],
        [-0.4924038765061043, 250],
        [-0.4851478631379983, 251],
        [-0.4755282581475769, 252],
        [-0.463591927283394, 253],
        [-0.44939702314958324, 254],
        [-0.43301270189221924, 255],
        [-0.4145187862775209, 256],
        [-0.3940053768033613, 257],
        [-0.37157241273869773, 258],
        [-0.3473291852294983, 259],
        [-0.3213938048432697, 260],
        [-0.29389262614623685, 261],
        [-0.2649596321166031, 262],
        [-0.2347357813929464, 263],
        [-0.20336832153790152, 264],
        [-0.1710100716628345, 265],
        [-0.13781867790850014, 266],
        [-0.10395584540887887, 267],
        [-0.0695865504800323, 268],
        [-0.03487823687206262, 269],
        [-3.6739403974420594e-16, 270],
        [0.03487823687206189, 271],
        [0.06958655048003158, 272],
        [0.10395584540887816, 273],
        [0.13781867790849942, 274],
        [0.1710100716628338, 275],
        [0.20336832153790083, 276],
        [0.23473578139294574, 277],
        [0.2649596321166025, 278],
        [0.29389262614623624, 279],
        [0.32139380484326907, 280],
        [0.3473291852294978, 281],
        [0.37157241273869723, 282],
        [0.39400537680336084, 283],
        [0.41451878627752053, 284],
        [0.43301270189221885, 285],
        [0.4493970231495829, 286],
        [0.4635919272833937, 287],
        [0.47552825814757665, 288],
        [0.485147863137998, 289],
        [0.4924038765061042, 290],
        [0.4972609476841367, 291],
        [0.4996954135095479, 292],
        [0.4996954135095479, 293],
        [0.49726094768413676, 294],
        [0.49240387650610423, 295],
        [0.48514786313799824, 296],
        [0.47552825814757693, 297],
        [0.463591927283394, 298],
        [0.44939702314958324, 299],
        [0.4330127018922192, 300],
        [0.414518786277521, 301],
        [0.39400537680336134, 302],
        [0.37157241273869784, 303],
        [0.34732918522949835, 304],
        [0.32139380484326974, 305],
        [0.2938926261462369, 306],
        [0.26495963211660317, 307],
        [0.23473578139294646, 308],
        [0.20336832153790158, 309],
        [0.17101007166283458, 310],
        [0.1378186779085002, 311],
        [0.10395584540887894, 312],
        [0.06958655048003237, 313],
        [0.034878236872062686, 314],
        [4.286263797015736e-16, 315],
        [-0.03487823687206183, 316],
        [-0.06958655048003151, 317],
        [-0.10395584540887809, 318],
        [-0.13781867790849936, 319],
        [-0.17101007166283377, 320],
        [-0.20336832153790077, 321],
        [-0.23473578139294568, 322],
        [-0.26495963211660245, 323],
        [-0.29389262614623624, 324],
        [-0.321393804843269, 325],
        [-0.3473291852294978, 326],
        [-0.37157241273869723, 327],
        [-0.39400537680336084, 328],
        [-0.4145187862775205, 329],
        [-0.4330127018922188, 330],
        [-0.4493970231495829, 331],
        [-0.4635919272833937, 332],
        [-0.47552825814757665, 333],
        [-0.485147863137998, 334],
        [-0.49240387650610407, 335],
        [-0.4972609476841367, 336],
        [-0.4996954135095479, 337],
        [-0.4996954135095479, 338],
        [-0.4972609476841368, 339],
        [-0.49240387650610434, 340],
        [-0.4851478631379983, 341],
        [-0.4755282581475769, 342],
        [-0.46359192728339405, 343],
        [-0.44939702314958335, 344],
        [-0.43301270189221924, 345],
        [-0.414518786277521, 346],
        [-0.3940053768033614, 347],
        [-0.3715724127386978, 348],
        [-0.3473291852294984, 349],
        [-0.32139380484326974, 350],
        [-0.29389262614623696, 351],
        [-0.2649596321166033, 352],
        [-0.2347357813929465, 353],
        [-0.20336832153790163, 354],
        [-0.17101007166283463, 355],
        [-0.13781867790850028, 356],
        [-0.10395584540887899, 357],
        [-0.06958655048003243, 358],
        [-0.03487823687206275, 359],
        [-4.898587196589413e-16, 360],
      ];
    }
  },
  methods: {
    getOptions(data) {
      return {
        polar: {
          center: ["50%", "54%"],
        },
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
          },
        },
        angleAxis: {
          type: "value",
          startAngle: 0,
        },
        radiusAxis: {
          min: 0,
        },
        series: [
          {
            coordinateSystem: "polar",
            name: "line",
            type: "line",
            showSymbol: false,
            data,
          },
        ],
        animationDuration: 2000,
      };
    },
  },
};
</script>